Rtutil : Other routing tools
This module provides some miscellaneous tools about network routing.
User can use the following code to import the rtutil module.
var rtutil = require('router/rtutil');
Support
The following shows rtutil module APIs available for each permissions.
| User Mode | Privilege Mode | |
|---|---|---|
| rtutil.nameServer | ● | |
| rtutil.forward | ● | |
| rtutil.qos | ● |
Rtutil Object
rtutil.nameServer([domain])
domain{Integer} Network protocol domain, must be:socket.AF_INETorsocket.AF_INET6. default: undefined means all domain.- Returns: {Array} Array of name servers currently in use.
Example
var servers = rtutil.nameServer();
console.log(servers);
rtutil.forward()
- Returns: {Boolean} Whether routing is enabled on the current machine.
Get the current routing and forwarding status.
rtutil.forward(ipv4[, ipv6])
ipv4{Boolean} Enable or disable IPv4 routing and forwarding.ipv6{Boolean} Enable or disable IPv6 routing and forwarding. default: false.- Returns: {Boolean} Whether routing is enabled on the current machine.
Enable or disable routing and forwarding.
Example
rtutil.forward(true); // Enable IPv4 routing.
rtutil.qos()
- Returns: {Boolean} Whether QoS state on the current machine.
Get the current QoS master switch status.
rtutil.qos(enable)
enable{Boolean} Enable or disable network QoS.- Returns: {Boolean} Whether QoS is enabled on the current machine.
Enable or disable network QoS master switch.
Example
rtutil.qos(true); // Enable QoS.




陕公网安备61019002002605号